#include "general.h"

#include <buola/term/ctermbox.h>
#include <buola/widgets/cmenubar.h>
#include <buola/widgets/ctheme.h>

CMainWindow::CMainWindow()
{
    SetTitle(L"Buola terminal");

    mBox=new CTermBox;
    mBox->sTitleChanged.Connect(&CMainWindow::OnTitleChanged,this);
    mBox->sExited.Connect(&CMainWindow::OnExited,this);

    Attach(mBox,gui::ATTACH_REPLACECLIENT);

    mBox->OpenShell();
    mBox->SetFocus();
}

void CMainWindow::OnTitleChanged()
{
    SetTitle(mBox->GetTitle());
}

void CMainWindow::OnExited()
{
    Close();
}
